import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

// 登录/首页/404/401/跳转 静态路由
export const constantRoutes = [
  // {
  //   path: '/redirect',
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: '/redirect/:path(.*)',
  //       component: r => require(['@/views/redirect/index'], r)
  //     }
  //   ]
  // },
  {
    path: '/login',
    component: r => require(['@/views/guide/index'], r),
    hidden: true
  },
]

const createRouter = () => new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher
}

export default router
